package com.coolweather.android.util;

import okhttp3.OkHttpClient;
import okhttp3.Request;

/**
 * 工具类
 * 用于和服务器交互
 */
public class HttpUtil {

    /**
     * 发送请求时，调用sendOkHttpRequest()方法
     * @param address   请求地址
     * @param callback  回调，用于处理服务器响应
     */
    public static void sendOkHttpRequest(String address, okhttp3.Callback callback){
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder().url(address).build();
        client.newCall(request).enqueue(callback);
    }
}
